<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="">
	<meta name="author" content="">
	<link rel="icon" href="../../favicon.ico">
	<title>管理员修改密码</title>
	#parse('/headFiles.html')
</head>
<body>
<div class="layui-fluid">
	<div class="layui-card">
		<div class="layui-card-header">修改登录密码</div>
          <div class="layui-card-body">
            <div class="layui-form" win100>
              <div class="layui-form-item">
                <label class="layui-form-label">旧登录密码</label>
                <div class="layui-input-inline">
                  <input name="oldPassword" class="layui-input" type="password" lay-vertype="tips" lay-verify="required">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">新登录密码</label>
                <div class="layui-input-inline">
                  <input name="password" class="layui-input" id="LAY_password" type="password" autocomplete="off" lay-vertype="tips" lay-verify="pass">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">确认新密码</label>
                <div class="layui-input-inline">
                  <input name="repassword" class="layui-input" type="password" autocomplete="off" lay-vertype="tips" lay-verify="repass">
                </div>
              </div>
              <div class="layui-form-item">
                <div class="layui-input-block">
                  <button class="layui-btn" lay-filter="setmypass" lay-submit="" id="btn">提交修改</button>
                </div>
              </div>
            </div>
		</div>
	</div>
</div>
#parse('/footFiles.html')
<script type="text/javascript">
  layui.config({
    base: '$!{webRoot}/assets/layuiadmin/'
  }).extend({
    index: 'lib/index'
  }).use(['index', 'form'], function(){
	  var $ = layui.$, form = layui.form;
	  
	  $("#btn").click(function(){
		  var oldPassword=$("input[name='oldPassword']").val();
		  var password=$("input[name='password']").val();
		  var repassword=$("input[name='repassword']").val();
		  if(password == repassword){
			  $.ajax({
				 type:"post",
				 url: "$!{webRoot}/sys/manager/self/updatePwd.do",
		         data:{'oldPassword':oldPassword,'password':password},
		         dataType:"json",
		         success:function(res){
						if(res.code == 200){
							layer.msg("修改成功");
							$("input[name='oldPassword']").val("");
							$("input[name='password']").val("");
							$("input[name='repassword']").val("");
						}else{
							layer.msg(res.msg,{icon: 2});
						}
					}
			  });
		  }else{
			  layer.msg("两次密码必须一致");
		  }
	  });
  });
</script>
</body>
</html>